<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
	th:with="title='评论管理',active='comments'">
<header th:replace="admin/header::headerFragment(${title},${active})"></header>
<body class="fixed-left">
	<div id="wrapper">
		<div th:replace="admin/header::header-body"></div>
		<div class="content-page">
			<div class="content">
				<div class="container">
					<div class="row">
						<div class="col-sm-12">
							<h4 class="page-title">评论管理</h4>
						</div>
						<div class="col-md-12">
							<table class="table table-striped table-bordered">
								<thead >
									<tr style="text-align:center">
										<th style="text-align:center">评论内容</th>
										<th style="text-align:center">评论人</th>
										<th style="text-align:center">评论时间</th>
										<th style="text-align:center">评论状态</th>
										<th style="text-align:center">操作</th>
									</tr>
								</thead>
								<tbody style="text-align:center">
									<th:block th:each="comment : ${articleCommentList.list}">
										<tr th:attr="id=${comment.id}">
											<td th:text="${comment.content}"></td>
											<td th:if="${comment.commentUserId} eq 1">管理员</td>
											<td th:if="${comment.commentUserId} ne 1">其他人</td>
											<td th:text="${comment.createTime} "></td>
											<td><th:block>
													<span class="label label-success">审核通过</span>
												</th:block></td>
											<td><a href="javascript:void(0)"
												th:onclick="'delComment('+${comment.id}+');'"
												class="btn btn-danger btn-sm waves-effect waves-light m-b-5"><i
													class="fa fa-trash-o"></i> <span>删除</span></a></td>
										</tr>
									</th:block>
								</tbody>
							</table>
						</div>
						<!-- 分页开始 -->
						<div>
							<div class="clearfix">
								<ul class="pagination m-b-5 pull-left">
									<li th:if="${articleCommentList.hasPreviousPage}"><a
										th:href="@{'/admin/comments?page='+${articleCommentList.prePage}}"
										aria-label="Previous"> <i class="fa fa-angle-left"></i>&nbsp;上一页
									</a></li>

									<th:block th:each="nav : ${articleCommentList.navigatepageNums}">
										<li th:class="${nav==articleCommentList.pageNum}?'active':''"><a
											th:href="@{'/admin/comments?page='+${nav}}" th:text="${nav}"></a></li>
									</th:block>

									<th:block th:if="${articleCommentList.hasNextPage}">
										<li><a
											th:href="@{'/admin/comments?page='+${articleCommentList.nextPage}}"
											aria-label="Next"> 下一页&nbsp;<i class="fa fa-angle-right"></i>
										</a></li>
									</th:block>

									<li><span th:text="'共'+${articleCommentList.pages}+'页'"></span></li>
								</ul>
							</div>
						</div>
						<!-- 分页结束 -->
					</div>
					<div th:replace="admin/footer :: footer-content"></div>
				</div>
			</div>
		</div>
	</div>
	<div th:replace="admin/footer :: footer"></div>
	<script type="text/javascript">
		/*<![CDATA[*/
		var tale = new $.tale();
	
		function delComment(id) {
			tale.alertConfirm({
				title : '确定删除该评论吗?',
				then : function() {
					tale.post({
						url : '/blog/admin/comments/delete',
						data : {
							id : id
						},
						success : function(result) {
							if (result.msg=="success") {
								tale.alertOkAndReload('评论删除成功');
								Pause(this,300);
								window.location.reload();
							} else {
								tale.alertError(result.msg || '评论删除失败');
							}
						}
					});
				}
			});
		}
	</script>
</body>
</html>